import Vue from 'vue'
import Router from 'vue-router'
import Tab from '@/components/tab/tab'
import Message from '@/components/message'
import My from '@/components/my'

import Talking from '@/components/talking'
import TopUp from '@/components/topUp'
import Register from '@/components/register'
import MyFriend from '@/components/myFriend'
import OpenVip from '@/components/openVip'
import GlodLog from '@/components/glodLog'
import ChangeMessage from '@/components/changeMessage'
import Withdraw from '@/components/withdraw'
import Active from '@/components/active'
import Impower from '@/components/impower'
import Protocol from '@/components/protocol'

const routes = [
  {  //登录
    path: '/',
    redirect: 'Register',
    meta: {
      title: "登录"
      },
    // component: Register
  },
  {
    path: '/index.html',
    name: 'Register',
    meta: {
      title: "登录"
      },
    component: Register
  },
  {  //首页tab
    // path: '/',
    path: '/tab/tab',
    name: 'Tab',
    component: Tab,
    meta: {
      title: "聊Q小屋"
      },
  },
  { //消息页
    // path: '/',
    path: '/message',
    name: 'Message',
    meta: {
      title: "聊Q小屋"
      },
    component: Message
  },
  { //授权
    // path: '/',
    path: '/impower',
    name: 'Impower',
    component: Impower
  },
  { //我的页
    // path: '/',
    path: '/my',
    name: 'My',
    meta: {
      title: "我的"
      },
    component: My
  },
  { //聊天页
    // path: '/',
    path: '/talking',
    name: 'Talking',
    meta: {
      title: "聊Q小屋"
      },
    component: Talking
  },
  { //充值页
    // path: '/',
    path: '/topUp',
    name: 'TopUp',
    meta: {
      title: "充值页"
      },
    component: TopUp
  },
  { //注册
    // path: '/',
    path: '/register',
    name: 'Register',
    meta: {
      title: "登录"
      },
    component: Register
  },
  { //myFriend我的好友
    // path: '/',
    path: '/myFriend',
    name: 'MyFriend',
    meta: {
      title: "我的好友"
      },
    component: MyFriend
  },
  { //vip 开通vip
    // path: '/',
    path: '/openVip',
    name: 'OpenVip',
    meta: {
      title: "开通VIP"
      },
    component: OpenVip
  },
  { //Q豆记录
    // path: '/',
    path: '/glodLog',
    name: 'GlodLog',
    meta: {
      title: "Q豆记录"
      },
    component: GlodLog
  },
  { //我的信息 编辑
    // path: '/',
    path: '/changeMessage',
    name: 'ChangeMessage',
    meta: {
      title: "我的信息"
      },
    component: ChangeMessage
  },
  { //提现
    // path: '/',
    path: '/withdraw',
    name: 'Withdraw',
    meta: {
      title: "提现"
      },
    component: Withdraw
  },
  { //抽奖
    // path: '/',
    path: '/active',
    name: 'Active',
    meta: {
      title: "活动"
      },
    component: Active
  },
  { //注册协议
    // path: '/',
    path: '/protocol',
    name: 'Protocol',
    meta: {
      title: "登录协议"
      },
    component: Protocol
  },
]
  
  const router = new Router({
  mode: 'hash',
  routes: routes
  })
  
  router.beforeEach((to, from, next) => {
  if (to.meta.title) {
  document.title = to.meta.title
  }
  next();
  })

  export default router
// export default new Router({
//   routes: [
//     {  //登录
//       path: '/',
//       redirect: 'Register',
//       meta: {
//         title: "登录"
//         },
//       // component: Register
//     },
//     {
//       path: '/index.html',
//       name: 'Register',
//       meta: {
//         title: "登录"
//         },
//       component: Register
//     },
//     {  //首页tab
//       // path: '/',
//       path: '/tab/tab',
//       name: 'Tab',
//       component: Tab,
//       meta: {
//         title: "聊Q小屋"
//         },
//     },
//     { //消息页
//       // path: '/',
//       path: '/message',
//       name: 'Message',
//       meta: {
//         title: "聊Q小屋"
//         },
//       component: Message
//     },
//     { //授权
//       // path: '/',
//       path: '/impower',
//       name: 'Impower',
//       component: Impower
//     },
//     { //我的页
//       // path: '/',
//       path: '/my',
//       name: 'My',
//       meta: {
//         title: "我的"
//         },
//       component: My
//     },
//     { //聊天页
//       // path: '/',
//       path: '/talking',
//       name: 'Talking',
//       component: Talking
//     },
//     { //充值页
//       // path: '/',
//       path: '/topUp',
//       name: 'TopUp',
//       component: TopUp
//     },
//     { //注册
//       // path: '/',
//       path: '/register',
//       name: 'Register',
//       component: Register
//     },
//     { //myFriend我的好友
//       // path: '/',
//       path: '/myFriend',
//       name: 'MyFriend',
//       component: MyFriend
//     },
//     { //vip 开通vip
//       // path: '/',
//       path: '/openVip',
//       name: 'OpenVip',
//       component: OpenVip
//     },
//     { //Q豆记录
//       // path: '/',
//       path: '/glodLog',
//       name: 'GlodLog',
//       component: GlodLog
//     },
//     { //我的信息 编辑
//       // path: '/',
//       path: '/changeMessage',
//       name: 'ChangeMessage',
//       component: ChangeMessage
//     },
//     { //提现
//       // path: '/',
//       path: '/withdraw',
//       name: 'Withdraw',
//       component: Withdraw
//     },
//     { //抽奖
//       // path: '/',
//       path: '/active',
//       name: 'Active',
//       component: Active
//     },
//     { //注册协议
//       // path: '/',
//       path: '/protocol',
//       name: 'Protocol',
//       component: Protocol
//     },
//   ]
// })
